package mmesh;

import hdgeom.interfaces.HasInside;
import processing.core.PMatrix3D;

public class CubeMesh extends MMesh implements HasInside {
	public CubeMesh(float x1,float y1,float z1,float x2,float y2,float z2){
		
		this.xc=new float[8];
		this.yc=new float[8];
		this.zc=new float[8];
		xc=new float[]{x1,x1,x2,x2,x1,x1,x2,x2};
		yc=new float[]{y1,y2,y2,y1,y1,y2,y2,y1};
		zc=new float[]{z1,z1,z1,z1,z2,z2,z2,z2};
		this.triangles=new int[36];
		int[][]quads=new int[6][4];
		quads[0]=new int[]{3,2,1,0};
		
		quads[1]=new int[]{0,1,5,4};
		quads[2]=new int[]{1,2,6,5};
		quads[3]=new int[]{2,3,7,6};
		quads[4]=new int[]{3,4,4,7};
		
		quads[5]=new int[]{4,5,6,7};
		int iT=0;
		for (int i=0;i<quads.length;i++){
			int[] quad=quads[i];
			triangles[iT]=quad[0];
			triangles[iT+1]=quad[1];
			triangles[iT+2]=quad[2];
			
			triangles[iT+3]=quad[2];
			triangles[iT+4]=quad[3];
			triangles[iT+5]=quad[1];
			iT+=6;
		}
	}
	

	public static CubeMesh createCube(float x1,float y1,float z1,float x2,float y2,float z2){
		
		return null;
	}
	public void transform(PMatrix3D matrix){
		
	}
	
}
